
// initial state
const state = {
  coaches: '',
  tab: 0,
  trains: ''
};

// getters
const getters = {
  allcoaches: state => state.coaches,
  alltrains: state => state.trains,
  tabs: state => state.tab
};

// actions
const actions = {
  upcoachesment({ commit }, newcoaches) {
    commit('addment', newcoaches);
  },
  uptrainsment({ commit }, newtrains) {
    commit('uptrains', newtrains);
  },
  uptab({ commit }, tabvalue) {
    commit('uptab', tabvalue);
  }
};

// mutations
const mutations = {
  addment(state, newcoaches) {
    state.coaches = newcoaches;
  },
  uptab(state, tabvalue) {
    state.tab = tabvalue;
  },
  uptrains(state, newtrains) {
    state.trains = newtrains;
  }
};

export default {
  state,
  getters,
  actions,
  mutations
};
